import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class FailWidget extends StatelessWidget {
  final Function() onClick;
  final String title;
  final String content;
  final String button;


  const FailWidget({Key key, this.onClick, this.title='网络异常', this.content='请检查网络后刷新重试', this.button='点我'}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Column(
      children: <Widget>[
        Padding(
          padding: EdgeInsets.fromLTRB(249.w, 100.h, 248.w, 49.h),
          child: new Image.asset(
            "images/fail.png",
            height: 237.h,
            width: 253.w,
          ),
        ),
        Padding(
          padding: EdgeInsets.fromLTRB(255.w, 0.h, 256.w, 122.h),
          child: Column(
            children: <Widget>[
              new Text(
                title,
                style: new TextStyle(fontSize: 24.sp, color: Color(0X9982868E)),
              ),
              new Column(
                children: <Widget>[
                  new Text(
                    content,
                    style: new TextStyle(
                        fontSize: 24.sp, color: Color(0X9982868E)),
                  ),
                ],
              )
            ],
          ),
        ),
        SizedBox(
          width: 260.w,
          height: 92.h,
          child: new OutlineButton(
            color: Colors.white,
            textColor: Color(0XFF0CABCB),
            child: new Text(button),
            onPressed: onClick,
            borderSide: BorderSide(
                color: Colors.blue, width: 1.w, style: BorderStyle.solid),
          ),
        ),
      ],
    );
  }
}
